<%@page language="java" contentType="text/html; character=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/common/taglibs.jsp"%>

<%@ page import="com.javapandeng.analys.VisitorCounter" %>
<%
    //訪問量
    String count = VisitorCounter.readCount("F:/res.txt");
    if (session.getAttribute("visit") == null) {
        session.setAttribute("visit", "y");//将未访问设置为访问
        session.setMaxInactiveInterval(1*30);//设置最大时效    单位是秒

        int count1 = Integer.parseInt(count);
        count1 = count1 + 1;
        count = String.valueOf(count1).toString();
        VisitorCounter.writeCount("F:/res.txt", count);
    }
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>首页</title>
    <link type="text/css" rel="stylesheet" href="${ctx}/resource/user/css/style.css">
    <script src="${ctx}/resource/user/js/jquery-1.8.3.min.js"></script>
    <script src="${ctx}/resource/user/js/jquery.luara.0.0.1.min.js"></script>
</head>
<body>
<div class="width100 hidden_yh" style="border-top: 1px solid #ddd">
    <div class="width1200 hidden_yh center_yh" style="margin-top: 75px">
        <form action="" method="" >
            <div class="center_yh hidden_yh " style="width: 475px;margin-bottom: 40px;">
                <span style="margin-right: 40px;height: 42px;line-height: 42px;width: 100px;" class="left_yh block_yh tright">用户名：</span>
                <input type="text" id="empName_add_input" name="userName" placeholder="2-5位中文或6-16位英文和数字组合" style="border:1px solid #c9c9c9;width: 292px;height: 42px;font-size: 16px;text-indent: 22px;" class="left_yh yhm" >

            </div>
            <div class="center_yh hidden_yh " style="width: 475px;margin-bottom: 40px;">
                <span style="margin-right: 40px;height: 42px;line-height: 42px;width: 100px;" class="left_yh block_yh tright">设置密码：</span>
                <input type="text" id="passWord" name="passWord" placeholder="密码必须是6~18位之间的数字" style="border:1px solid #c9c9c9;width: 292px;height: 42px;font-size: 16px;text-indent: 22px;" class="left_yh szmm">
            </div>
            <div class="center_yh hidden_yh " style="width: 475px;margin-bottom: 40px;">
                <span style="margin-right: 40px;height: 42px;line-height: 42px;width: 100px;" class="left_yh block_yh tright">手机号：</span>
                <input type="text" id="phone" name="phone" placeholder="手机号码必须是1开头的，总数为11位" style="border:1px solid #c9c9c9;width: 292px;height: 42px;font-size: 16px;text-indent: 22px;" class="left_yh sjh">
            </div>
            <div class="center_yh hidden_yh " style="width: 475px;margin-bottom: 40px;">
                <span style="margin-right: 40px;height: 42px;line-height: 42px;width: 100px;" class="left_yh block_yh tright">电子邮箱：</span>
                <input type="text" id="email_add_input" name="email" placeholder="请输入邮箱" style="border:1px solid #c9c9c9;width: 292px;height: 42px;font-size: 16px;text-indent: 22px;" class="left_yh dzyx">
            </div>
            <p class="font14 c_66" style="text-indent: 500px;margin-top: 30px;">
                <input type="checkbox">我已阅读并同意<a href="#" class="red">《会员注册协议》</a>和<a href="#" class="red">《隐私保护政策》</a>
            </p>
            <input type="submit" id="emps_save_btn" value="提交" class="ipt_tj" style="width: 295px;height: 44px;margin-left: 500px;">
        </form>
    </div>
</div>
<%@include file="/common/ufooter.jsp"%>
</body>

    <script>

        //校验表单数据
        $("#emps_save_btn").click(function(){
            //1、要拿到校验数据，使用正则表达式校验
            var empName = $("#empName_add_input").val();
            var passWord = $("#passWord").val();
            var phone = $("#phone").val();
            var email = $("#email_add_input").val();
            var f = true;

            var regName = /(^[a-zA-Z0-9_-]{6,16}$)|(^[\u2E80-\u9FFF]+$)/;
            if(!regName.test(empName)){
                alert("用户名可以是2-5位中文或者6-16位英文和数字组合");
                f = false;
            }
            var PassWord = /^[1-9a-zA-Z]{6,16}$/;
            if(!PassWord.test(passWord)){
                alert("密码必须是6~18位之间的数字");
                f = false;
            }
            var Phone = /(^1[0-9]{10}$)/;
            if(!Phone.test(phone)){
                alert("手机号码必须是1开头的，总数为11位");
                f = false;
            }
            //2、校验邮箱规则
            var regEmail = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
            if(!regEmail.test(email)){
                alert("邮箱格式不正确");
                f = false;
            }

            if(f == true){
                $.ajax({
                    type:"POST",
                    url:"${ctx}/login/toRes",
                    data:{
                        "userName":empName,
                        "passWord":passWord,
                        "phone":phone,
                        "email":email,

                    },
                    success:function (){
                        alert("注册成功，请登入！");
                        window.location.href = "${ctx}/login/uLogin";
                    }
                });
            }
        });

    </script>

</html>



















